package cn.tedu.boot11.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author Administrator
 */
@Controller
public class HelloController {
    /**
     * http://localhost:8080/hello
     */
    @RequestMapping("/hello")
    public void hello(HttpServletResponse response) throws IOException {
        // 设置响应数据
        response.setContentType("text/html;charset=utf-8");
        // 得到输出对象 异常抛出
        PrintWriter pw = response.getWriter();
        // 输出数据
        pw.print("服务器接收到了请示!<h1>测试成功</h1>");
        // 关闭资源
        pw.close();
    }
}
